import 'package:favoritecate/ui/pages/filter/filter_page.dart';
import 'package:flutter/material.dart';


class FYHomeDrawer extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 250,
      child: Drawer(
        child: Column(
          children: <Widget>[
            buildHeaderView(context),
            buildListTitle(context,Icon(Icons.restaurant), '进餐',(){
              //进餐
              Navigator.of(context).pop();
            }),
            buildListTitle(context,Icon(Icons.settings), '过滤',(){
              //过滤
              Navigator.of(context).pop();
              Navigator.of(context).pushNamed(FYFilterPage.routeName);
            })
          ],
        ),
      ),
    );
  }

  Widget buildHeaderView(BuildContext context){
    return Container(
      color: Colors.orangeAccent,
      alignment: Alignment(0,0.5),
      width: double.infinity,
      height: 120,
      child: Text('开始动手',style: Theme.of(context).textTheme.display3.copyWith(fontWeight: FontWeight.bold),),
    );
  }

  Widget buildListTitle(BuildContext context,Widget icon,String title,Function handle){
    return ListTile(
      leading: icon,
      title: Text(title,style: Theme.of(context).textTheme.display2,),
      onTap: handle,
    );
  }

//  Widget buildListTitle(Widget icon,String title){
//    return Container(
//      height: 70,
//      child: Row(
//        children: <Widget>[
//          SizedBox(width: 20,),
//          icon,
//          SizedBox(width: 20,),
//          Text(title)
//        ],
//      ),
//    );
//  }
}
